<?php
declare (strict_types = 1);

namespace app\common\middleware;

use app\common\facade\admin\HomeAdmin;

class Admin
{
    /**
     * 处理请求
     *
     * @param \think\Request $request
     * @param \Closure       $next
     * @return Response
     */
    public function handle($request, \Closure $next)
    {

        try {
             HomeAdmin::checkLogin();
        } catch (\Exception $e) {
            return exceptionJson($e->getMessage(), $e->getCode());
        }

        return $next($request);
    }
}
